local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.BaseComponent());

-- 控制装饰物
function M.new(self,...)
	return M(self,...);
end;


function M.ctor(self, parent)
	M.super.ctor(self, parent);

    self.index=1
    self.DecorateFolder=self.parent:WaitForChild_Loop("decorate")
    self.DecorateList=self.DecorateFolder:GetChildren()
    self.AllCount=#self.DecorateList
    for _,v in pairs( self.DecorateList) do
        v.Parent=game.ReplicatedStorage
    end
    self:NextShow()

    self.parent.WaveProgressUpdEvent:Connect(function()
        self:NextShow()
    end)
end;


function M.NextShow(self)
    if self.Active then
        self.Active.Parent=game.ReplicatedStorage
    end
   self.Active= self.DecorateList[self.index]
   self.Active.Parent=self.DecorateFolder
   self.index=self.index+1
   if  self.index>self.AllCount then
        self.index=1
   end
end



function M.dtor(self)
    self.DecorateFolder:ClearAllChildren()

	M.super.dtor(self);
end;


return M